<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   架构师面试总结  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/22639.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466459832: Accept with keywords: (title(0.25):总结,架构师,社区,数盟, topn(0.366666666667):社区,子类,数盟,网络,行业资讯,文件夹,内存,数组,数据挖掘,设计模式,文件,遍历,数据库,职业规划,视图,基础架构,文章,方法,变量,问题,算法,逻辑,编程语言,数据,代码,业务,线程,部分,时候,模式).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    架构师面试总结
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    架构师面试总结 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,54] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech/base">
       基础架构
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/22639.html">
          架构师面试总结
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          1,447 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech/base" rel="category tag">
          基础架构
         </a>
         ,
         <a href="http://dataunion.org/category/tech/devl" rel="category tag">
          编程语言
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <h3>
        摘要
       </h3>
       <p>
        本文原创，转载请注明地址：
        <a href="http://kymjs.com/code/2016/03/08/01" target="_blank">
         http://kymjs.com/code/2016/03/08/01
        </a>
        <br/>
        “基础 Android 知识掌握的不错，学习能力也不错。但是基础知识部分比较薄弱，有些概念和逻辑掌握不清。” 感谢春林的这句话。
       </p>
       <h2 id="mvcmvp--mvvm">
        MVC，MVP 和 MVVM
       </h2>
       <ul>
        <li>
         MVC 通信方式，环形方式：
         <br/>
         1、View 传送指令到 Controller
         <br/>
         2、Controller 起到不同层面间的组织作用，用于控制应用程序的流程。它处理事件并作出响应。“事件”包括用户的行为和数据 Model 上的改变。
         <br/>
         3、Model 将新的数据发送到 View，用户得到反馈
         <br/>
         所有通信都是单向的。
         <br/>
         <img src="http://kymjs.com/images/blog_image/20160308_1.png"/>
        </li>
        <li>
         MVP 通信方式：
         <br/>
         1、各部分之间的通信，都是双向的。
         <br/>
         2、View 与 Model 不发生联系，都通过 Presenter 传递。
         <br/>
         3、View 非常薄，不部署任何业务逻辑，称为”被动视图”（Passive View），即没有任何主动性，而 Presenter非常厚，所有逻辑都部署在那里。
         <br/>
         <img src="http://kymjs.com/images/blog_image/20160308_2.png"/>
        </li>
        <li>
         MVVM 模式是 MVP 的升级：
         <br/>
         基本上与 MVP 模式完全一致。唯一的区别是，它采用双向绑定：View的变动，自动反映在 ViewModel，反之亦然。
         <br/>
         <img src="http://kymjs.com/images/blog_image/20160308_3.png"/>
         <br/>
         (以上内容取自：
         <a href="http://www.ruanyifeng.com/blog/2015/02/mvcmvp_mvvm.html" target="_blank">
          http://www.ruanyifeng.com/blog/2015/02/mvcmvp_mvvm.html
         </a>
         )
        </li>
       </ul>
       <p>
        我们针对业务模型，建立的数据结构和相关的类，就可以理解为AndroidApp 的 Model，Model 是与 View 无关，而与业务相关的，例如数据库读取数据，应该是属于model层的事情。（感谢@Xander的讲解）
        <br/>
        我的猜想：
       </p>
       <blockquote>
        <p>
         至于为什么我们通常直接去在 Activity 中去写数据库数据读取，我的猜想是因为简单。试想，如果是为了规范，首先定义一个getDataFromDB()的接口，再写个类实现getDataFromDB()方法，以后如果改了请求数据所用的方法，直接改写实现类，听起来确实不错，可是仅仅是为了从数据库读点数据，额外添加了至少两个类文件真的有意义吗。
         <br/>
         当然网络请求，是属于业务逻辑层C层。
        </p>
       </blockquote>
       <p>
        MVP中 Presenter 真正需要处理的并非业务逻辑，而应该是视图逻辑。业务逻辑应该是视图无关的，可以是单独的一个类中，也可以是在P中。
        <br/>
        P与V是一对多关系
        <br/>
        EventBus应该作用于P层，在P层发送，在P层接收。
       </p>
       <p>
        MVVM中，M层改变并不是直接改变V层，而是通过VM层去改变V层。M与V依旧是不直接操作的。
       </p>
       <p>
        相关介绍：
        <a href="http://www.tianmaying.com/tutorial/AndroidMVC" target="_blank">
         http://www.tianmaying.com/tutorial/AndroidMVC
        </a>
       </p>
       <h2 id="section">
        架构的定义
       </h2>
       <p>
        有关软件整体结构与组件的抽象描述，用于指导大型软件系统各个方面的设计。
        <br/>
        总结一下，就是一整个软件工程项目中的骨架，是一种宏观的规划。
       </p>
       <h2 id="volley">
        Volley相关
       </h2>
       <h3 id="volley-1">
        Volley的磁盘缓存
       </h3>
       <p>
        在面试的时候，聊到 Volley 请求到网络的数据缓存。当时说到是 Volley 会将每次通过网络请求到的数据，采用
        <code>
         FileOutputStream
        </code>
        ，写入到本地的文件中。
        <br/>
        那么问题来了：这个缓存文件，是声明在一个SD卡文件夹中的(也可以是getCacheFile())。如果不停的请求网络数据，这个缓存文件夹将无限制的增大，最终达到SD卡容量时，会发生无法写入的异常(因为存储空间满了)。
        <br/>
        这个问题的确以前没有想到，当时也没说出怎么回事。回家了赶紧又看了看代码才知道，原来 Volley 考虑过这个问题(汗!想想也是)
        <br/>
        翻看代码
        <code>
         DiskBasedCache#pruneIfNeeded()
        </code>
       </p>
       <div class="highlight">
        <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
        <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576866b5ea407566654225" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
         <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <span class="crayon-title">
          </span>
          <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-wrap-button" title="切换自动换行">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-expand-button" title="点击展开代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-copy-button" title="复制代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <span class="crayon-language">
            Java
           </span>
          </div>
         </div>
         <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
         </div>
         <div class="crayon-plain-wrap">
          <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
           private void pruneIfNeeded(int neededSpace) {
    if ((mTotalSize + neededSpace) &lt; mMaxCacheSizeInBytes) {
        return;
    }
    
    long before = mTotalSize;
    int prunedFiles = 0;
    long startTime = SystemClock.elapsedRealtime();

    Iterator&lt;Map.Entry&lt;String, CacheHeader&gt;&gt; iterator = mEntries.entrySet().iterator();
    while (iterator.hasNext()) {
        Map.Entry&lt;String, CacheHeader&gt; entry = iterator.next();
        CacheHeader e = entry.getValue();
        boolean deleted = getFileForKey(e.key).delete();
        if (deleted) {
            mTotalSize -= e.size;
        } else {
	//print log
        }
        iterator.remove();
        prunedFiles++;
        if ((mTotalSize + neededSpace) &lt; mMaxCacheSizeInBytes * HYSTERESIS_FACTOR) {
            break;
        }
    }
}
          </textarea>
         </div>
         <div class="crayon-main" style="">
          <table class="crayon-table">
           <tbody>
            <tr class="crayon-row">
             <td class="crayon-nums " data-settings="show">
              <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-1">
                1
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-2">
                2
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-3">
                3
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-4">
                4
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-5">
                5
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-6">
                6
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-7">
                7
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-8">
                8
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-9">
                9
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-10">
                10
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-11">
                11
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-12">
                12
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-13">
                13
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-14">
                14
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-15">
                15
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-16">
                16
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-17">
                17
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-18">
                18
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-19">
                19
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-20">
                20
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-21">
                21
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-22">
                22
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-23">
                23
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-24">
                24
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea407566654225-25">
                25
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea407566654225-26">
                26
               </div>
              </div>
             </td>
             <td class="crayon-code">
              <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
               <div class="crayon-line" id="crayon-576866b5ea407566654225-1">
                <span class="crayon-m">
                 private
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 void
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 pruneIfNeeded
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 neededSpace
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-2">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 if
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 mTotalSize
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 neededSpace
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 mMaxCacheSizeInBytes
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-3">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 return
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-4">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-5">
                <span class="crayon-h">
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-6">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 long
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 before
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 mTotalSize
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-7">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 prunedFiles
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-8">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 long
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 startTime
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 SystemClock
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 elapsedRealtime
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-9">
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-10">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 Iterator
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-v">
                 Map
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 Entry
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-t">
                 String
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 CacheHeader
                </span>
                <span class="crayon-o">
                 &gt;&gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 iterator
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 mEntries
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 entrySet
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 iterator
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-11">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 while
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 iterator
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 hasNext
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-12">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 Map
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 Entry
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-t">
                 String
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 CacheHeader
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 entry
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 iterator
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 next
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-13">
                <span class="crayon-h">
                </span>
                <span class="crayon-i">
                 CacheHeader
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 e
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 entry
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 getValue
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-14">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 boolean
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 deleted
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 getFileForKey
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 e
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 key
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 delete
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-15">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 if
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 deleted
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-16">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 mTotalSize
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 -=
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 e
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 size
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-17">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 else
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-18">
                <span class="crayon-h">
                </span>
                <span class="crayon-c">
                 //print log
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-19">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-20">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 iterator
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 remove
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-21">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 prunedFiles
                </span>
                <span class="crayon-o">
                 ++
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-22">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 if
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 mTotalSize
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 neededSpace
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 mMaxCacheSizeInBytes
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 *
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 HYSTERESIS_FACTOR
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-23">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 break
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-24">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea407566654225-25">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea407566654225-26">
                <span class="crayon-sy">
                 }
                </span>
               </div>
              </div>
             </td>
            </tr>
           </tbody>
          </table>
         </div>
        </div>
        <!-- [Format Time: 0.0253 seconds] -->
        <br/>
        <p>
        </p>
       </div>
       <p>
        其中
        <code>
         mMaxCacheSizeInBytes
        </code>
        是构造方法传入的一个缓存文件夹的大小，如果不传默认是5M的大小。
        <br/>
        通过这个方法可以发现，每当被调用时会传入一个
        <code>
         neededSpace
        </code>
        ，也就是需要申请的磁盘大小(即要新缓存的那个文件所需大小)。首先会判断如果这个
        <code>
         neededSpace
        </code>
        申请成功以后是否会超过最大可用容量，如果会超过，则通过遍历本地已经保存的缓存文件的header(header中包含了缓存文件的缓存有效期、占用大小等信息)去删除文件，直到可用容量不大于声明的缓存文件夹的大小。
        <br/>
        其中
        <code>
         HYSTERESIS_FACTOR
        </code>
        是一个值为0.9的常量，应该是为了防止误差的存在吧(我猜的)。
       </p>
       <h3 id="volley-2">
        Volley缓存命中率的优化
       </h3>
       <p>
        如果让你去设计Volley的缓存功能，你要如何增大它的命中率。
        <br/>
        可惜了，如果上面的缓存功能是昨天看的，今天的面试这个问题就能说出来了。
        <br/>
        还是上面的代码，在缓存内容可能超过缓存文件夹的大小时，删除的逻辑是直接遍历header删除。这个时候删除的文件有可能是我们上一次请求时刚刚保存下来的，屁股都还没坐稳呢，现在立即删掉，有点舍不得啊。
        <br/>
        如果遍历的时候，判断一下，首先删除超过缓存有效期的(过期缓存)，其次按照LRU算法，删除最久未使用的，岂不是更合适？
       </p>
       <h3 id="volley-3">
        Volley缓存文件名的计算
       </h3>
       <p>
        这个是我一直没弄懂的问题。
        <br/>
        如下代码：
       </p>
       <div class="highlight">
        <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
        <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576866b5ea41a044475755" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
         <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <span class="crayon-title">
          </span>
          <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-wrap-button" title="切换自动换行">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-expand-button" title="点击展开代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-copy-button" title="复制代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <span class="crayon-language">
            Java
           </span>
          </div>
         </div>
         <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
         </div>
         <div class="crayon-plain-wrap">
          <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
           private String getFilenameForKey(String key) {
    int firstHalfLength = key.length() / 2;
    String localFilename = String.valueOf(key.substring(0, firstHalfLength).hashCode());
    localFilename += String.valueOf(key.substring(firstHalfLength).hashCode());
    return localFilename;
}
          </textarea>
         </div>
         <div class="crayon-main" style="">
          <table class="crayon-table">
           <tbody>
            <tr class="crayon-row">
             <td class="crayon-nums " data-settings="show">
              <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
               <div class="crayon-num" data-line="crayon-576866b5ea41a044475755-1">
                1
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea41a044475755-2">
                2
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea41a044475755-3">
                3
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea41a044475755-4">
                4
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea41a044475755-5">
                5
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea41a044475755-6">
                6
               </div>
              </div>
             </td>
             <td class="crayon-code">
              <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
               <div class="crayon-line" id="crayon-576866b5ea41a044475755-1">
                <span class="crayon-m">
                 private
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 String
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 getFilenameForKey
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-t">
                 String
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 key
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea41a044475755-2">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 firstHalfLength
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 key
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 length
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 2
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea41a044475755-3">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 String
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 localFilename
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 String
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 valueOf
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 key
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 substring
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 firstHalfLength
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 hashCode
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea41a044475755-4">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 localFilename
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +=
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 String
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 valueOf
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 key
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 substring
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 firstHalfLength
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 hashCode
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea41a044475755-5">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 return
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 localFilename
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea41a044475755-6">
                <span class="crayon-sy">
                 }
                </span>
               </div>
              </div>
             </td>
            </tr>
           </tbody>
          </table>
         </div>
        </div>
        <!-- [Format Time: 0.0169 seconds] -->
        <br/>
        <p>
        </p>
       </div>
       <p>
        为什么会要把一个key分成两部分，分别求hashCode，最后又做拼接。
        <br/>
        这个问题之前在stackoverflow上问过
        <a href="http://stackoverflow.com/questions/34984302/why-volley-diskbasedcache-splicing-without-direct-access-to-the-cache-file-name/34987423#34987423" target="_blank">
         #链接
        </a>
        <br/>
        原谅我，别人的回答我最初并没有看懂。直到最近被问到，如果让你设计一个HashMap，如何避免value被覆盖，我才想到原因。
        <br/>
        先来看一下
        <code>
         String#hashCode()
        </code>
        的实现：
       </p>
       <div class="highlight">
        <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
        <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576866b5ea422882696234" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
         <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <span class="crayon-title">
          </span>
          <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-wrap-button" title="切换自动换行">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-expand-button" title="点击展开代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-copy-button" title="复制代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <span class="crayon-language">
            Java
           </span>
          </div>
         </div>
         <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
         </div>
         <div class="crayon-plain-wrap">
          <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
           @Override public int hashCode() {
    int hash = hashCode;
    if (hash == 0) {
        if (count == 0) {
            return 0;
        }
        final int end = count + offset;
        final char[] chars = value;
        for (int i = offset; i &lt; end; ++i) {
            hash = 31*hash + chars[i];
        }
        hashCode = hash;
    }
    return hash;
}
          </textarea>
         </div>
         <div class="crayon-main" style="">
          <table class="crayon-table">
           <tbody>
            <tr class="crayon-row">
             <td class="crayon-nums " data-settings="show">
              <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
               <div class="crayon-num" data-line="crayon-576866b5ea422882696234-1">
                1
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea422882696234-2">
                2
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea422882696234-3">
                3
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea422882696234-4">
                4
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea422882696234-5">
                5
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea422882696234-6">
                6
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea422882696234-7">
                7
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea422882696234-8">
                8
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea422882696234-9">
                9
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea422882696234-10">
                10
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea422882696234-11">
                11
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea422882696234-12">
                12
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea422882696234-13">
                13
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea422882696234-14">
                14
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea422882696234-15">
                15
               </div>
              </div>
             </td>
             <td class="crayon-code">
              <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
               <div class="crayon-line" id="crayon-576866b5ea422882696234-1">
                <span class="crayon-n">
                 @Override
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-m">
                 public
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 hashCode
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea422882696234-2">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 hash
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 hashCode
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea422882696234-3">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 if
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 hash
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 ==
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea422882696234-4">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 if
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 count
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 ==
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea422882696234-5">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 return
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea422882696234-6">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea422882696234-7">
                <span class="crayon-h">
                </span>
                <span class="crayon-m">
                 final
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 end
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 count
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 offset
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea422882696234-8">
                <span class="crayon-h">
                </span>
                <span class="crayon-m">
                 final
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 char
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 chars
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 value
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea422882696234-9">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 for
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 offset
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 end
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 ++
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea422882696234-10">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 hash
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 31
                </span>
                <span class="crayon-o">
                 *
                </span>
                <span class="crayon-v">
                 hash
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 chars
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea422882696234-11">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea422882696234-12">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 hashCode
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 hash
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea422882696234-13">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea422882696234-14">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 return
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 hash
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea422882696234-15">
                <span class="crayon-sy">
                 }
                </span>
               </div>
              </div>
             </td>
            </tr>
           </tbody>
          </table>
         </div>
        </div>
        <!-- [Format Time: 0.0051 seconds] -->
        <br/>
        <p>
        </p>
       </div>
       <p>
        从上面的实现可以看到，String的hashcode是根据字符数组中每个位置的字母的int值再加上上次hash值乘以31，这种算法求出来的，至于为什么是31，我也不清楚。
        <br/>
        但是可以肯定一点，hashcode并不是唯一的。不信你运行下面这两个输出：
       </p>
       <div class="highlight">
        <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
        <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576866b5ea429444754976" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
         <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <span class="crayon-title">
          </span>
          <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-wrap-button" title="切换自动换行">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-expand-button" title="点击展开代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-copy-button" title="复制代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <span class="crayon-language">
            Java
           </span>
          </div>
         </div>
         <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
         </div>
         <div class="crayon-plain-wrap">
          <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
           System.out.print("======" + "vFrKiaNHfF7t[9::E[XsX?L7xPp3DZSteIZvdRT8CX:w6d;v&lt;_KZnhsM_^dqoppe".hashCode());
System.out.print("======" + "hI4pFxGOfS@suhVUd:mTo_begImJPB@Fl[6WJ?ai=RXfIx^=Aix@9M;;?Vdj_Zsi".hashCode());
          </textarea>
         </div>
         <div class="crayon-main" style="">
          <table class="crayon-table">
           <tbody>
            <tr class="crayon-row">
             <td class="crayon-nums " data-settings="show">
              <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
               <div class="crayon-num" data-line="crayon-576866b5ea429444754976-1">
                1
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea429444754976-2">
                2
               </div>
              </div>
             </td>
             <td class="crayon-code">
              <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
               <div class="crayon-line" id="crayon-576866b5ea429444754976-1">
                <span class="crayon-v">
                 System
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 out
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 print
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-s">
                 "======"
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-s">
                 "vFrKiaNHfF7t[9::E[XsX?L7xPp3DZSteIZvdRT8CX:w6d;v&lt;_KZnhsM_^dqoppe"
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 hashCode
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea429444754976-2">
                <span class="crayon-v">
                 System
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 out
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 print
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-s">
                 "======"
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-s">
                 "hI4pFxGOfS@suhVUd:mTo_begImJPB@Fl[6WJ?ai=RXfIx^=Aix@9M;;?Vdj_Zsi"
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 hashCode
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
              </div>
             </td>
            </tr>
           </tbody>
          </table>
         </div>
        </div>
        <!-- [Format Time: 0.0016 seconds] -->
        <br/>
        <p>
        </p>
       </div>
       <p>
        这两个字符串是根据hashcode的算法逆向出来的，他们的hashcode都是12345。逆向算法请见
        <a href="http://my.oschina.net/backtract/blog/169310" target="_blank">
         这里
        </a>
        <br/>
        再回到我们的问题，为什么会要把一个key分成两部分。现在可以肯定的答出，目的是为了尽可能避免hashcode重复造成的文件名重复(求两次hash两次都与另一个url重复的概率总要比一次重复的概率小吧)。
        <br/>
        顺带再提一点，就像上面说的，概率小并不代表不存在。但是Java计算hashcode的速度是很快的，应该是在效率和安全性上取舍的结果吧。
       </p>
       <h2 id="tcpudphttp">
        推送心跳包是TCP包还是UDP包或者HTTP包
       </h2>
       <p>
        其实聊起这个问题是因为最近看到
        <a href="http://weibo.com/u/2951317192" target="_blank">
         @睡不着起不来的万宵
        </a>
        同学写的一篇文章《
        <a href="http://www.jianshu.com/p/584707554ed7" target="_blank">
         Android推送技术研究
        </a>
        》结果就产生了这个没回答出来的问题(妈蛋，自己给自己挖坑 – -)
        <br/>
        最后看了这篇文章(好像是转的，没找到原地址)
        <a href="http://blog.csdn.net/wangliang198901/article/details/16542567" target="_blank">
         android 心跳的分析
        </a>
        <br/>
        原来心跳包的实现是调用了
        <code>
         socket.sendUrgentData(0xFF)
        </code>
        这句代码实现的，所以，当然是TCP包。
       </p>
       <h2 id="argb8888">
        ARGB_8888占用内存大小
       </h2>
       <p>
        首先说说本题的答案，是4byte，即ARGB各占用8个比特来描述。当时回答错了，详细解答看这里
        <a href="http://bugly.qq.com/bbs/forum.php?mod=viewthread&amp;tid=498" target="_blank">
         你的 Bitmap 究竟占多大内存
        </a>
        <br/>
        但是——
        <br/>
        这个问题引出了一个大大的闹剧，请听我慢慢道来。😂😂😂
        <br/>
        不知道怎么就聊到 Bitmap 压缩上了，他说他们的Bitmap居然都是不压缩的😂😂😂
        <br/>
        还是直接甩代码吧。。。。
       </p>
       <div class="highlight">
        <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
        <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576866b5ea432105567703" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
         <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <span class="crayon-title">
          </span>
          <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-wrap-button" title="切换自动换行">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-expand-button" title="点击展开代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-copy-button" title="复制代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <span class="crayon-language">
            Java
           </span>
          </div>
         </div>
         <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
         </div>
         <div class="crayon-plain-wrap">
          <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
           public static Bitmap create(byte[] bytes, int maxWidth, int maxHeight) {
		//上面的省略了
        option.inJustDecodeBounds = true;
        BitmapFactory.decodeByteArray(bytes, 0, bytes.length, option);
        int actualWidth = option.outWidth;
        int actualHeight = option.outHeight;

        // 计算出图片应该显示的宽高
        int desiredWidth = getResizedDimension(maxWidth, maxHeight, actualWidth, actualHeight);
        int desiredHeight = getResizedDimension(maxHeight, maxWidth, actualHeight, actualWidth);

        option.inJustDecodeBounds = false;
        option.inSampleSize = findBestSampleSize(actualWidth, actualHeight,
                desiredWidth, desiredHeight);
        Bitmap tempBitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, option);

        // 做缩放
        if (tempBitmap != null
                &amp;&amp; (tempBitmap.getWidth() &gt; desiredWidth || tempBitmap
                .getHeight() &gt; desiredHeight)) {
            bitmap = Bitmap.createScaledBitmap(tempBitmap, desiredWidth,
                    desiredHeight, true);
            tempBitmap.recycle();
        } else {
            bitmap = tempBitmap;
        }
    }

    return bitmap;
}
          </textarea>
         </div>
         <div class="crayon-main" style="">
          <table class="crayon-table">
           <tbody>
            <tr class="crayon-row">
             <td class="crayon-nums " data-settings="show">
              <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-1">
                1
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-2">
                2
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-3">
                3
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-4">
                4
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-5">
                5
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-6">
                6
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-7">
                7
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-8">
                8
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-9">
                9
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-10">
                10
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-11">
                11
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-12">
                12
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-13">
                13
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-14">
                14
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-15">
                15
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-16">
                16
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-17">
                17
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-18">
                18
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-19">
                19
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-20">
                20
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-21">
                21
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-22">
                22
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-23">
                23
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-24">
                24
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-25">
                25
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-26">
                26
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-27">
                27
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-28">
                28
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea432105567703-29">
                29
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea432105567703-30">
                30
               </div>
              </div>
             </td>
             <td class="crayon-code">
              <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
               <div class="crayon-line" id="crayon-576866b5ea432105567703-1">
                <span class="crayon-m">
                 public
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-m">
                 static
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 Bitmap
                </span>
                <span class="crayon-e">
                 create
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-t">
                 byte
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 bytes
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 maxWidth
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 maxHeight
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-2">
                <span class="crayon-h">
                </span>
                <span class="crayon-c">
                 //上面的省略了
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-3">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 option
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 inJustDecodeBounds
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 true
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-4">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 BitmapFactory
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 decodeByteArray
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 bytes
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 bytes
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 length
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 option
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-5">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 actualWidth
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 option
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 outWidth
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-6">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 actualHeight
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 option
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 outHeight
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-7">
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-8">
                <span class="crayon-h">
                </span>
                <span class="crayon-c">
                 // 计算出图片应该显示的宽高
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-9">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 desiredWidth
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 getResizedDimension
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 maxWidth
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 maxHeight
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 actualWidth
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 actualHeight
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-10">
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 int
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 desiredHeight
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 getResizedDimension
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 maxHeight
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 maxWidth
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 actualHeight
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 actualWidth
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-11">
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-12">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 option
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 inJustDecodeBounds
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 false
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-13">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 option
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 inSampleSize
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 findBestSampleSize
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 actualWidth
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 actualHeight
                </span>
                <span class="crayon-sy">
                 ,
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-14">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 desiredWidth
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 desiredHeight
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-15">
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 Bitmap
                </span>
                <span class="crayon-v">
                 tempBitmap
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 BitmapFactory
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 decodeByteArray
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 bytes
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 bytes
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-v">
                 length
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 option
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-16">
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-17">
                <span class="crayon-h">
                </span>
                <span class="crayon-c">
                 // 做缩放
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-18">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 if
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 tempBitmap
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 !=
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 null
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-19">
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;&amp;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 tempBitmap
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 getWidth
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 desiredWidth
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 ||
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-i">
                 tempBitmap
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-20">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 getHeight
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 desiredHeight
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-21">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 bitmap
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 Bitmap
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 createScaledBitmap
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 tempBitmap
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 desiredWidth
                </span>
                <span class="crayon-sy">
                 ,
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-22">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 desiredHeight
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 true
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-23">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 tempBitmap
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 recycle
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-24">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 else
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 {
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-25">
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 bitmap
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 tempBitmap
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-26">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-27">
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-28">
               </div>
               <div class="crayon-line" id="crayon-576866b5ea432105567703-29">
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 return
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 bitmap
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea432105567703-30">
                <span class="crayon-sy">
                 }
                </span>
               </div>
              </div>
             </td>
            </tr>
           </tbody>
          </table>
         </div>
        </div>
        <!-- [Format Time: 0.0232 seconds] -->
        <br/>
        <p>
        </p>
       </div>
       <p>
        你这么做，decodeByteArray两次不是更占内存吗？😂😂😂
        <br/>
        第一次设置inJustDecodeBounds = true 时候是不占内存的，因为返回的是null
        <br/>
        一脸不相信我的说：噢，这地方我下去再看看。
        <br/>
        吓得我回来了以后赶紧又看了看，还好没有记错，见源码注释
       </p>
       <div class="highlight">
        <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
        <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576866b5ea439427834879" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
         <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <span class="crayon-title">
          </span>
          <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-wrap-button" title="切换自动换行">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-expand-button" title="点击展开代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-copy-button" title="复制代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <span class="crayon-language">
            Inventor iLogic
           </span>
          </div>
         </div>
         <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
         </div>
         <div class="crayon-plain-wrap">
          <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
           /**
 * If set to true, the decoder will return null (no bitmap), but
 * the out... fields will still be set, allowing the caller to query
 * the bitmap without having to allocate the memory for its pixels.
 */
public boolean inJustDecodeBounds;
          </textarea>
         </div>
         <div class="crayon-main" style="">
          <table class="crayon-table">
           <tbody>
            <tr class="crayon-row">
             <td class="crayon-nums " data-settings="show">
              <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
               <div class="crayon-num" data-line="crayon-576866b5ea439427834879-1">
                1
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea439427834879-2">
                2
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea439427834879-3">
                3
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea439427834879-4">
                4
               </div>
               <div class="crayon-num" data-line="crayon-576866b5ea439427834879-5">
                5
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576866b5ea439427834879-6">
                6
               </div>
              </div>
             </td>
             <td class="crayon-code">
              <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
               <div class="crayon-line" id="crayon-576866b5ea439427834879-1">
                <span class="crayon-c">
                 /**
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea439427834879-2">
                <span class="crayon-c">
                 * If set to true, the decoder will return null (no bitmap), but
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea439427834879-3">
                <span class="crayon-c">
                 * the out... fields will still be set, allowing the caller to query
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea439427834879-4">
                <span class="crayon-c">
                 * the bitmap without having to allocate the memory for its pixels.
                </span>
               </div>
               <div class="crayon-line" id="crayon-576866b5ea439427834879-5">
                <span class="crayon-c">
                 */
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576866b5ea439427834879-6">
                <span class="crayon-m">
                 public
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 boolean
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 inJustDecodeBounds
                </span>
                <span class="crayon-sy">
                 ;
                </span>
               </div>
              </div>
             </td>
            </tr>
           </tbody>
          </table>
         </div>
        </div>
        <!-- [Format Time: 0.0011 seconds] -->
        <br/>
        <p>
        </p>
       </div>
       <h2 id="activityoncreateonstart">
        Activity中类似onCreate、onStart运用了哪种设计模式，优点是什么
       </h2>
       <p>
        这个回答的太多了，我当时说的是代理模式，因为
        <code>
         AppCompatActivity
        </code>
        中的确是使用的代理模式。这一点还要感谢
        <a href="http://weibo.com/daimajia" target="_blank">
         @代码家
        </a>
        当时说让我看看
        <code>
         AppCompatDelegate
        </code>
        类的设计。其主要目的就是通过使用组合来替代继承，降低了耦合。
        <br/>
        不过回家后再想一想，对方想听到的应该是模板方法模式吧。在父类中实现一个算法不变的部分，并将可变的行为留给子类来实现。生命周期方法原本就是在基类中做出了Activity不同状态时回调的一系列方法，而这些方法具体需要做的可变部分交给子类去完成。
       </p>
       <h2 id="hashmap">
        HashMap的底层实现
       </h2>
       <p>
        HashMap内部是通过数组实现的，诶，大学时候数据结构有讲过啊，都忘记了。根据hash算法，求出当前key应该存放在数组的那个index处，如果有值了，则存在相邻的下一个位置。
        <br/>
        根据如果自己实现HashMap如何防止value覆盖。同上面 Volley 中讲到的。
       </p>
       <h2 id="atomicvolatilesynchronized">
        Atomic、volatile、synchronized区别
       </h2>
       <p>
        面Java基础的时候遇上了这个问题，说如果只有一个i++;的时候，
        <code>
         volatile
        </code>
        和
        <code>
         synchronized
        </code>
        能否互换。当时也不知道，感觉
        <code>
         volatile
        </code>
        作为修饰变量的时候，变量自加会出现加到一半发生线程调度。再看看当时蒙对了。
        <br/>
        <code>
         volatile
        </code>
        可以保证在一个线程的工作内存中修改了该变量的值，该变量的值立即能回显到主内存中，从而保证所有的线程看到这个变量的值是一致的。但是有个前提，因为它不具有操作的原子性，也就是它不适合在对该变量的写操作依赖于变量本身自己。就比如i++、i+=1;这种。但是可以改为num=i+1;如果i是一个
        <code>
         volatile
        </code>
        类型，那么num就是安全的，总之就是不能作用于自身。
        <br/>
        <code>
         synchronized
        </code>
        是基于代码块的，只要包含在
        <code>
         synchronized
        </code>
        块中，就是线程安全的。
        <br/>
        既然都说了线程安全，就多了解几个：
        <br/>
        <code>
         AtomicInteger
        </code>
        ，一个轻量级的
        <code>
         synchronized
        </code>
        。使用的并不是同步代码块，而是Lock-Free算法(我也不懂，看代码就是一个死循环调用了底层的比较方法直到相同后才退出循环)。最终的结果就是在高并发的时候，或者说竞争激烈的时候效率比
        <code>
         synchronized
        </code>
        高一些。
        <br/>
        <code>
         ThreadLocal
        </code>
        ，线程中共享数据。主要用于多个线程共享内部的同一个数据时，使用时需要注意
        <code>
         static
        </code>
        。
        <br/>
        详细分析见
        <a href="http://blog.csdn.net/u010687392/article/details/50549236" target="_blank">
         这篇文章
        </a>
        。
        <br/>
        再补一个，才学到的。利用
        <code>
         clone()
        </code>
        方法，如果是一个类的多个对象想共用对象内部的一个变量，而又不想这个变量static，可以使用浅复制方式。(查看设计模式原型模式)
       </p>
       <h2 id="section-1">
        其他
       </h2>
       <p>
        做内部库设计时，最重要的考虑是jar的成本，方法数、体积。
        <br/>
        设计模式不应该是去记忆，而应该是用的时候自然而然的用上。
       </p>
       <blockquote>
        <p>
         3月11日更新
         <br/>
         面试真的是有够烦的，因为题目是随机的，而知识是无穷的。直到被很多答案都是没有标准的。就好像上面提到的 MV* ，也许到现在上面的理解依旧有问题，但是我觉得架构是死的，而最合适的才是最好的。
         <br/>
         但是有一点，面试也是一种学习，至少它能让你知道你的薄弱点在哪。
        </p>
       </blockquote>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/24678.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/20140917125452915416-216x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24678.html" rel="bookmark" title="python3中的正则模块">
         python3中的正则模块
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24675.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/t015b337bd75d9ef893-161x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24675.html" rel="bookmark" title="注释是恶魔，请不要再写一行注释">
         注释是恶魔，请不要再写一行注释
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24670.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/20141222134630106-300x164.png"/>
        </a>
        <a class="link" href="http://dataunion.org/24670.html" rel="bookmark" title="Apache Spark 不过时的六大理由">
         Apache Spark 不过时的六大理由
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24660.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/u16130037972892789947fm21gp0-300x157.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24660.html" rel="bookmark" title="如何从Github上轻松安装R包">
         如何从Github上轻松安装R包
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F22639.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/22639.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/22639.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>